package com.uottawa.librarytest.dao;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.uottawa.library.dao.BaseDAO;
import com.uottawa.library.dao.LoanDAO;
import com.uottawa.library.dao.UserDAO;
import com.uottawa.library.domain.Loan;
import com.uottawa.library.domain.User;

public class LoanDAOTest {

	private Loan loan;
	private UserDAO dao;
	
	@Before
	public void setUp() {
		dao = new UserDAO();
	}
	
	@After
	public void cleanUp() {
		new BaseDAO().cleanUp();
	}

	
	@Test
	public void userHasNoOutStandingLateFee()
	{
		//late fee
		User user = new User(25, "OkUser", "password", 0, "user");
		UserDAO userDAO = new UserDAO();
		userDAO.addUser(user);
		double lateFee = userDAO.getUserBalance(user.getUserId());
		assertEquals(0,lateFee, 0.01);
	
	}
	
	@Test
	public void userHasLateFee_IsNotAuthorizedToLoan()
	{
		User user = new User(1, "OkUser", "password", 120, "user");
		UserDAO userDAO = new UserDAO();
		userDAO.addUser(user);
		boolean isAuothorized= user.IsAuthorizedToLoan();
		assertFalse(isAuothorized);
	}

	/* Scenario:
	 */

}
